package vn.sunnet.backviet01.game.coloa.util.mypool;

import org.anddev.andengine.opengl.texture.region.TextureRegion;
import org.anddev.andengine.util.pool.GenericPool;

import vn.sunnet.backviet01.game.coloa.human.enemy.BloodLine;

public class BloodLinePools extends GenericPool<BloodLine>{
	private TextureRegion mTextureRegion;
	private TextureRegion mBloodTextureRegion;
	
	public BloodLinePools(TextureRegion pTextureRegion, TextureRegion pBloodTextureRegion) {
		if (pTextureRegion == null) {
			throw new IllegalArgumentException("The texture region must not be NULL");
		} 
		mTextureRegion = pTextureRegion;
		mBloodTextureRegion = pBloodTextureRegion;
	}
	@Override
	protected BloodLine onAllocatePoolItem() {
		return new BloodLine(0, 0, mTextureRegion.deepCopy(), mBloodTextureRegion.deepCopy());
	}
	protected void onHandleRecycleItem(final BloodLine pBloodLine) {
		pBloodLine.setIgnoreUpdate(true);
		pBloodLine.clearEntityModifiers();
		pBloodLine.clearUpdateHandlers();
		pBloodLine.setVisible(false);
		pBloodLine.detachSelf();
		pBloodLine.reset();
	}
	
}
